home *** CD-ROM | disk | FTP | other *** search
- property velMax, velMin
- property puloMax
- property sprPrim, sprUlt
- property area
- property lastUpdate
- property frameVolta
-
- on getBehaviorDescription
- return "Scroll horizontal de sprites"
- end
-
- on getPropertyDescriptionList
- set p_list = [ ¬
- #sprPrim: [ #comment: "Primeiro sprite a scrollar", ¬
- #format: #integer, ¬
- #default: 0 ], ¬
- #sprUlt: [ #comment: "Ultimo sprite a scrollar", ¬
- #format: #integer, ¬
- #default: 0], ¬
- #velMax: [ #comment: "Velocidade maxima (pix/s)",¬
- #format: #integer,¬
- #default: 80 ],¬
- #velMin: [ #comment: "Velocidade minima (pix/s)",¬
- #format: #integer,¬
- #default: 10 ],¬
- #puloMax: [ #comment: "Pulo maximo (pixels)",¬
- #format: #integer,¬
- #default: 30 ],¬
- #area: [ #comment: "Area de sensibilidade",¬
- #format: #integer,¬
- #default: 100 ],¬
- #frameVolta: [ #comment: "Frame para onde voltar",¬
- #format: #string,¬
- #default: "" ]¬
- ]
- return p_list
- end
-
-
- on exitFrame
- go the frame
- end
-
- on mouseUp
- sendAllSprites(#stopBola)
- global gAindaMomentos
- set gAindaMomentos = true
- sendAllSprites(#cleanSprite)
- set gAindaMomentos = false
- go frame frameVolta
- end
-
- on idle
- sendAllSprites(#idleSprite)
-
- set mx = the mouseH
- if mx < area then
- set vel = (velMax - velMin) * (area - mx) / area + velMin
- set pulo = (the timer - lastUpdate) * vel / 60
- if pulo > puloMax then set pulo = puloMax
- if pulo = 0 then set pulo = 1
- repeat with i = sprPrim to sprUlt
- sendSprite(i,#moveRel,pulo)
- end repeat
- set lastUpdate = the timer
- updateStage
- else if mx > 639 - area then
- set vel = (velMax - velMin) * (area - (639 - mx)) / area + velMin
- set pulo = (the timer - lastUpdate) * vel / 60
- if pulo > puloMax then set pulo = puloMax
- if pulo = 0 then set pulo = 1
- repeat with i = sprPrim to sprUlt
- sendSprite(i,#moveRel,-pulo)
- end repeat
- set lastUpdate = the timer
- updateStage
- else
- set lastUpdate = the timer
- end if
-
- end
-
-